﻿@model EmailIM
@{
    ViewBag.Title = "联系我们";
}
@section header{
<link href="~/Plugins/toastr/toastr.min.css" rel="stylesheet" />
    }

<div class="about-top contact-top">
    <section>
        <div class="container">
            <h1>contact us</h1>
            <h2>联系我们</h2>
        </div>
    </section>
</div>
<div class="container contact-bot">
    <div class="row">
        <div class="col-sm-4 col-md-3">
            <img src="~/Themes/Default/Content/img/logo_cn.png" />
            <ul class="contact">
                <li><i class="iconfont icon-phone"></i> @SettingsManager.Contact.Phone</li>
                <li><i class="iconfont icon-email"></i> @SettingsManager.Contact.MailTo</li>
                <li><i class="iconfont icon-map"></i> @SettingsManager.Contact.Address</li>
            </ul>
        </div>
        <div class="col-sm-8 col-md-9">
@using (Ajax.BeginForm("SendEmail", null, new AjaxOptions
{

    HttpMethod = "POST",
    OnBegin = "onBeginSave",
    OnComplete = "onCompleteSave",
    OnSuccess = "updateSuccess"

}, new { role = "form" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

            <div class="row dsl-form">
                <div class="col-sm-6 form-group">
                   
                    @Html.TextBoxFor(m => m.Name, new { @class = "form-control", placeholder = "姓名" })
                    @Html.ValidationMessageFor(model => model.Name)
                </div>
                <div class="col-sm-6 form-group">                  
                    @Html.TextBoxFor(m => m.Phone, new { @class = "form-control", placeholder = "联系电话" })
                    @Html.ValidationMessageFor(model => model.Phone)
                </div>
                <div class="col-sm-12 form-group">
                    @Html.TextBoxFor(m => m.Email, new { @class = "form-control", placeholder = "邮箱" })
                    @Html.ValidationMessageFor(model => model.Email)                  
                </div>
                <div class="col-sm-12 form-group">
                    @Html.TextAreaFor(m => m.Body, new { @class = "form-control", placeholder = "内容", rows = "4" })        
                    @Html.ValidationMessageFor(model => model.Body)
                    
                </div>
                <div class="col-sm-12 form-group text-right">
                    <button type="submit" class="btn">发送信息</button>
                </div>
            </div>
}
        </div>
    </div>
</div>

<div class="container-fluid page-footer">
    <div class="row">
        <div class="col-sm-6">
            <img src="~/Themes/Default/Content/img/logo_bot.png" />
        </div>
        <div class="col-sm-6 text-right">
            广东德思徕文化传播有限公司<br />
            &copy; GESLLE  INC. All Rights Reserved.
        </div>
    </div>
</div>

@section footer{
    @Scripts.Render("~/bundles/jqueryvalAjax")
    <script src="~/plugins/toastr/toastr.min.js"></script>
    <script>

    function onBeginSave() {
        $("#btnSave").text("发送中...");
    }
    function onCompleteSave() {
        $("#btnSave").text("提交");
    }

    function updateSuccess(data) {
        var title = '@ViewBag.Title';
      //  Common.ShowBox(data.Status, data.Message, title);

        switch (data.Status) {
            case 1:
                toastr.success(data.Message, title)
                break;
            case 2:
                toastr.error(data.Message, title)
                break;
            case 3:
                toastr.info(data.Message, title)
                break;
            case 4:
                toastr.warning(data.Message, title)
        }
    }

    </script>
}